package lab6_templateMethod;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class CeaiWithHook extends CaffeineBeverage{
	public void brew()
	{
		System.out.println("Steeping the tea ");
	}
	public void addCondiments()
	{
		System.out.println("Adauga lamaie");
	}
	public boolean customersWantsCondiments()
	{
		String answer=getUserInput();
		if(answer.toLowerCase().startsWith("y"))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	private String getUserInput()
	{
		String answer=null;
		System.out.println("Doriti lamaie pentru ceai? (y/n)");
		BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
		try{
			answer=in.readLine();
		}
		catch (IOException ioe)
		{
			System.out.println("Nu se poate citi raspunsul.");
		}
		if(answer==null)
			return "no";
		else
			return answer;
		
	}
}
